Skip to content

Install compact_index on test_setup#9578

Merged
hsbt merged 2 commits into
masterfrom
install-compact-index
Jun 1, 2026
Merged

Install compact_index on test_setup#9578
hsbt merged 2 commits into
masterfrom
install-compact-index

Conversation

@hsbt

@hsbt hsbt commented Jun 1, 2026

Copy link
Copy Markdown
Member

What was the end-user or developer problem that led to this PR?

Move compact_index vendoring from the vendor:compact_index rake task into install_test_deps so it runs uniformly across local rspec, bundler.yml, and ruby/ruby's make test-bundler-parallel, which does not invoke our `Rakefile.

The follow-up makes COMPACT_INDEX_REF=<sha> refresh the vendor tree instead of reusing the stale copy.

Make sure the following tasks are checked

hsbt and others added 2 commits June 1, 2026 19:13
The earlier `rake vendor:compact_index` hook into `dev:deps` and the
hard-copy step in ruby-core.yml fell apart in ruby/ruby's test-bundler
runner, which sets TMPDIR per process and does not invoke our rake
tasks. Pull the fetch logic into `Spec::Rubygems.install_vendored_compact_index`
and call it from `install_test_deps` so every test setup path - local
`bin/rspec`, `bin/parallel_rspec`, GHA bundler.yml, and ruby/ruby's
test-bundler - lands the files at `Path.tmp_root.join("compact_index")`
exactly where the artifice already looks. The standalone rake task and
its workflow hop are no longer needed.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Previously the install_vendored_compact_index short-circuit only checked
whether `tmp/compact_index/lib/compact_index.rb` existed, so once any ref
was vendored a subsequent `COMPACT_INDEX_REF=<sha> bin/rspec ...` kept
serving the stale copy. Drop the vendor tree first when the env var is
explicitly set so an override always re-fetches against the requested
ref.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 1, 2026 10:17

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR moves the compact_index vendoring step out of the vendor:compact_index Rake task and into the Bundler spec test setup, so the vendored compact_index code is installed consistently across local RSpec runs, CI, and ruby/ruby’s make test-bundler-parallel (which does not invoke this repo’s Rakefile).

Changes:

  • Add install_vendored_compact_index to Spec::Rubygems.install_test_deps so the compact_index implementation is present under tmp/compact_index/ whenever specs run.
  • Make COMPACT_INDEX_REF=<sha> force-refresh the vendor tree (delete then re-download) instead of reusing an existing copy.
  • Remove the vendor:compact_index task and drop it from rake setup prerequisites.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
spec/support/rubygems_ext.rb Installs vendored compact_index as part of test dependency setup, with optional ref override for refreshes.
Rakefile Removes the standalone vendoring task and stops calling it from rake setup.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +88 to +107
if ENV["COMPACT_INDEX_REF"]
FileUtils.rm_rf(target_root)
elsif File.exist?(target_root.join("lib/compact_index.rb"))
return
end

require "open-uri"
ref = ENV["COMPACT_INDEX_REF"] || "7c68a7b39761c61a66f9299f85b889ec39afc02c"
%w[
lib/compact_index.rb
lib/compact_index/dependency.rb
lib/compact_index/gem.rb
lib/compact_index/gem_version.rb
lib/compact_index/versions_file.rb
].each do |path|
url = "https://raw.githubusercontent.com/rubygems/rubygems.org/#{ref}/#{path}"
target = target_root.join(path)
FileUtils.mkdir_p(File.dirname(target))
File.write(target, URI.parse(url).open(&:read))
end
@hsbt hsbt merged commit 7343eef into master Jun 1, 2026
109 checks passed
@hsbt hsbt deleted the install-compact-index branch June 1, 2026 10:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants